function clearX(varargin)
% clearX('var1','var2',...)
%
% Clears all variables except those inputs user specifies.
%
%
% %%% ZCD Oct 2008 %%%
%

if ~isstr([varargin{:}])
    error('=== Input arguments should be strings only ===')
end

% get workspace variables
wsVars = evalin('caller','who');
% build the string vector to be cleared by taking all the strings in wsVars
% that do not appear in the user input
clVars = setdiff(wsVars,varargin);
% put variables into a string that can be called by clear
strList = sprintf('%s ',clVars{:});
% clear the variables in the workspace
evalin('caller', ['clear ' strList]);



